import site0Img from '/@/assets/map/Site0.png';
import site1Img from '/@/assets/map/Site1.png';
import site2Img from '/@/assets/map/Site2.png';
import site3Img from '/@/assets/map/Site3.png';
import site4Img from '/@/assets/map/Site4.png';
import site5Img from '/@/assets/map/Site5.png';
import site6Img from '/@/assets/map/Site6.png';
export const m_CurrentTypeIndicator_list = [
	{
		label: 'PM2.5',
		name: 'PM25',
	},
	{
		label: 'PM10',
		name: 'PM10',
	},
	{
		label: 'SO₂',
		name: 'SO2',
	},
	{
		label: 'NO₂',
		name: 'NO2',
	},
	{
		label: 'O₃',
		name: 'O3',
	},
	{
		label: 'CO',
		name: 'CO',
	},
	{
		label: 'VOC',
		name: 'Ext01',
	},
	{
		label: '温度',
		name: 'Temperature',
	},
	{
		label: '湿度',
		name: 'Humidity',
	},
	{
		label: '风向',
		name: 'WindDirection',
	},
	{
		label: '气压',
		name: 'AtmosphericPressure',
	},
];
export const level = [
	{
		label: '离线',
		color: '#6c757d',
		count: 0,
		siteIcon: site0Img,
	},
	{
		label: '优',
		color: '#00e400',
		count: 0,
		siteIcon: site1Img,
	},
	{
		label: '良',
		color: '#ffff00',
		count: 0,
		siteIcon: site2Img,
	},
	{
		label: '轻度污染',
		color: '#ff7e00',
		count: 0,
		siteIcon: site3Img,
	},
	{
		label: '中度污染',
		color: '#ff0000',
		count: 0,
		siteIcon: site4Img,
	},
	{
		label: '重度污染',
		color: '#99004c',
		count: 0,
		siteIcon: site5Img,
	},
	{
		label: '严重污染',
		color: '#7e0023',
		count: 0,
		siteIcon: site6Img,
	},
];

const limit = {
	data: {
		'0': {
			CO: [
				{
					Con_Lower: 0,
					Con_Upper: 5,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 5,
					Con_Upper: 10,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 10,
					Con_Upper: 35,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 35,
					Con_Upper: 60,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 60,
					Con_Upper: 90,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 90,
					Con_Upper: 120,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'CO',
					Remark: '0',
				},
				{
					Con_Lower: 120,
					Con_Upper: 150,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'CO',
					Remark: '0',
				},
			],
			O3: [
				{
					Con_Lower: 0,
					Con_Upper: 160,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 160,
					Con_Upper: 200,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 200,
					Con_Upper: 300,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 300,
					Con_Upper: 400,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 400,
					Con_Upper: 800,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 800,
					Con_Upper: 1000,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'O3',
					Remark: '0',
				},
				{
					Con_Lower: 1000,
					Con_Upper: 1200,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'O3',
					Remark: '0',
				},
			],
			SO2: [
				{
					Con_Lower: 0,
					Con_Upper: 150,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 150,
					Con_Upper: 500,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 500,
					Con_Upper: 650,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 650,
					Con_Upper: 800,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 800,
					Con_Upper: 1600,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 1600,
					Con_Upper: 2100,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'SO2',
					Remark: '0',
				},
				{
					Con_Lower: 2100,
					Con_Upper: 2620,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'SO2',
					Remark: '0',
				},
			],
			NO2: [
				{
					Con_Lower: 0,
					Con_Upper: 100,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 100,
					Con_Upper: 200,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 200,
					Con_Upper: 700,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 700,
					Con_Upper: 1200,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 1200,
					Con_Upper: 2340,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 2340,
					Con_Upper: 3090,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'NO2',
					Remark: '0',
				},
				{
					Con_Lower: 3090,
					Con_Upper: 3840,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'NO2',
					Remark: '0',
				},
			],
			PM25: [
				{
					Con_Lower: 0,
					Con_Upper: 35,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 35,
					Con_Upper: 75,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 75,
					Con_Upper: 115,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 115,
					Con_Upper: 150,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 150,
					Con_Upper: 250,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 250,
					Con_Upper: 350,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'PM25',
					Remark: '0',
				},
				{
					Con_Lower: 350,
					Con_Upper: 500,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'PM25',
					Remark: '0',
				},
			],
			PM10: [
				{
					Con_Lower: 0,
					Con_Upper: 50,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 50,
					Con_Upper: 150,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 150,
					Con_Upper: 250,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 250,
					Con_Upper: 350,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 350,
					Con_Upper: 420,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 420,
					Con_Upper: 500,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'PM10',
					Remark: '0',
				},
				{
					Con_Lower: 500,
					Con_Upper: 600,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'PM10',
					Remark: '0',
				},
			],
		},
		'1': {
			CO: [
				{
					Con_Lower: 0,
					Con_Upper: 2,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 2,
					Con_Upper: 4,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 4,
					Con_Upper: 14,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 14,
					Con_Upper: 24,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 24,
					Con_Upper: 36,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 36,
					Con_Upper: 48,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'CO',
					Remark: '1',
				},
				{
					Con_Lower: 48,
					Con_Upper: 60,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'CO',
					Remark: '1',
				},
			],
			O3: [
				{
					Con_Lower: 0,
					Con_Upper: 100,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 100,
					Con_Upper: 160,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 160,
					Con_Upper: 215,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 215,
					Con_Upper: 265,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 265,
					Con_Upper: 800,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 800,
					Con_Upper: 1000,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'O3',
					Remark: '1',
				},
				{
					Con_Lower: 1000,
					Con_Upper: 1200,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'O3',
					Remark: '1',
				},
			],
			SO2: [
				{
					Con_Lower: 0,
					Con_Upper: 50,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 50,
					Con_Upper: 150,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 150,
					Con_Upper: 475,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 475,
					Con_Upper: 800,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 800,
					Con_Upper: 1600,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 1600,
					Con_Upper: 2100,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'SO2',
					Remark: '1',
				},
				{
					Con_Lower: 2100,
					Con_Upper: 2620,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'SO2',
					Remark: '1',
				},
			],
			NO2: [
				{
					Con_Lower: 0,
					Con_Upper: 40,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 40,
					Con_Upper: 80,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 80,
					Con_Upper: 180,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 180,
					Con_Upper: 280,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 280,
					Con_Upper: 565,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 565,
					Con_Upper: 750,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'NO2',
					Remark: '1',
				},
				{
					Con_Lower: 750,
					Con_Upper: 940,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'NO2',
					Remark: '1',
				},
			],
			PM25: [
				{
					Con_Lower: 0,
					Con_Upper: 35,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 35,
					Con_Upper: 75,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 75,
					Con_Upper: 115,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 115,
					Con_Upper: 150,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 150,
					Con_Upper: 250,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 250,
					Con_Upper: 350,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'PM25',
					Remark: '1',
				},
				{
					Con_Lower: 350,
					Con_Upper: 500,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'PM25',
					Remark: '1',
				},
			],
			PM10: [
				{
					Con_Lower: 0,
					Con_Upper: 50,
					IAQI_Lower: 0,
					IAQI_Upper: 50,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 50,
					Con_Upper: 150,
					IAQI_Lower: 50,
					IAQI_Upper: 100,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 150,
					Con_Upper: 250,
					IAQI_Lower: 100,
					IAQI_Upper: 150,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 250,
					Con_Upper: 350,
					IAQI_Lower: 150,
					IAQI_Upper: 200,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 350,
					Con_Upper: 420,
					IAQI_Lower: 200,
					IAQI_Upper: 300,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 420,
					Con_Upper: 500,
					IAQI_Lower: 300,
					IAQI_Upper: 400,
					EnName: 'PM10',
					Remark: '1',
				},
				{
					Con_Lower: 500,
					Con_Upper: 600,
					IAQI_Lower: 400,
					IAQI_Upper: 500,
					EnName: 'PM10',
					Remark: '1',
				},
			],
		},
	},
};

export const getLimit = () => {
	let o: any = limit.data;
	for (const i in o) {
		Object.assign(o[i], {
			AQI: [
				{ Con_Lower: 0, Con_Upper: 50 },
				{ Con_Lower: 50, Con_Upper: 100 },
				{ Con_Lower: 100, Con_Upper: 150 },
				{ Con_Lower: 150, Con_Upper: 200 },
				{ Con_Lower: 200, Con_Upper: 300 },
				{ Con_Lower: 300, Con_Upper: Number.MAX_VALUE },
			],
		});
	}
	return o;
};

export const getAQILimit = (factor: string, value: number) => {
	let level = 0;
	let limit = getLimit();
	limit[0][factor.toUpperCase()]?.forEach((item, index) => {
		if (value >= item.Con_Lower && value < item.Con_Upper) {
			level = index + 1;
		}
	});
	if (level > 6 || level <= 0) level = 6;
	if (
		factor == 'Ext01' ||
		factor == 'Temperature' ||
		factor == 'Humidity' ||
		factor == 'WindSpeed' ||
		factor == 'WindDirection' ||
		factor == 'AtmosphericPressure'
	) {
		level = 1;
	}
	return level;
};
